package com.njts.cricule.src.com.njts.recycle;

/**
 * @author David GE
 * Date  2025/11/12
 */
public class EX2 {
    public static void main(String[] args) {
        //找出所有的水仙花数:即各位上数字的立方和等于自身的数
        // 1 确定范围
        for (int i = 1; i < 1000; i++) {
            // 2 拆分数位
            if (i==1){
                System.out.println(1);
            }
            else if (i>=10 && i<=99) {
                int ge = i%10;
                int sh=i/10;
                if (ge*ge*ge+sh*sh*sh==i){
                    System.out.println(i);
                }
            }
            else if (i>=100 && i<1000){
                int ge = i%10;
                int sh = i/10%10;
                int bai = i/100;
                if (ge*ge*ge+sh*sh*sh+bai*bai*bai==i){
                    System.out.println(i);
                }
            }

        }
    }
}
